import Home from '@/components/Home'
import Menu from '@/components/Menu'
import Admin from '@/components/Admin.vue'
import Register from '@/components/Register'
import Login from '@/components/Login'
import Header from '@/components/Header'
import About from '@/components/about/About'

//二级路由//
import Contact from '@/components/about/Contact'
import Delivery from '@/components/about/Delivery'
import OrderingGuide from '@/components/about/OrderingGuide'
import History from '@/components/about/History'

//三级路由//
import phone from '@/components/about/contact/Phone'
import personName from '@/components/about/contact/PersonName'



export const routes=[
  {path:"/",name:"homeLink",components:{
      default:Home,
     'orderingGuide':OrderingGuide,
     'history':History,
     'delivery':Delivery,

    }},
  {path:"/menu",name:"menuLink",component:Menu},
  {path:"/admin",name:"adminLink",component:Admin
    //实现路由独享守卫//
    // beforeEnter:(to,from,next)=>{
    //   // alert("非登陆状态，不能访问此页面，请登录");
    //   // // next();
    //   //   next(false);
    //     //判断store.getters.isLogin===false//
    //   if ( to.path =='/login' || to.path =='/register'){
    //     next();
    //   }else {
    //     alert("还没有登陆,请先登录！");
    //     next('/login');
    //   }

    // }
  },
  {path:"/register",name:"registerLink",component:Register},
  {path:"/login",name:"loginLink",component:Login},
  {path:"/header1",name:"headerLink",component:Header},
  {path:"/about",name:"aboutLink",redirect:'/about/contact',component:About,children:[
      {path:'/about/contact', name:"contactLink",redirect:'/contact/personName',component:Contact,children:[
          {path:'/contact/phone',name:"phoneNumber",component:phone},
          {path:'/contact/personName',name:"personName",component:personName},
        ]},
      {path:'/delivery', name:"deliveryLink",component:Delivery},
      {path:'/orderingGuide', name:"orderingGuideLink",component:OrderingGuide},
      {path:'/history', name:"historyLink",component:History},
    ]},
  {path:"*",redirect:'/'},
]
